package tuling;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * Created by xsls on 2019/6/10.
 */
public class TulingMainClass {

	public static void main(String[] args) {

		AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MainConfig.class);

		Object obj = ctx.getBean("tulingCalculate");
		if (obj instanceof Calculate) {
			System.out.println("-------------------Calculate----------------------" + obj.getClass());
			Calculate calculate = (Calculate) obj;
			int retVal = calculate.add(2, 4);
			 // calculate.div(2, 4);
			// System.out.println(((ProgramCalculate) calculate).toBinary(100));
		}

		if (obj instanceof TulingCalculate) {
			System.out.println("-------------------TulingCalculate----------------------" + obj.getClass());
			TulingCalculate calculate = (TulingCalculate) obj;
			int retVal = calculate.add(2, 4);
			// calculate.div(2, 4);
			// System.out.println(((ProgramCalculate) calculate).toBinary(100));
		}
        /*ProgramCalculate calculate = (ProgramCalculate) ctx.getBean("tulingCalculate");
        System.out.println(calculate.toBinary(100));*/
	}
}
